/**
 * 小程序商品列表页面
 */

const router = require('koa-router')();
const {
  getWXGoodsListService,
  getWXGoodsInfoService,
  getGoodsListService,
  getGoodsDetailService

} = require('../../service/goodsServer');

//获取商品列表
router.get("/api/miniapps/wxGoodsList", async (ctx, next) => {
  let params = ctx.request.query;
  await getWXGoodsListService(ctx, params);
})

//获取单条商品信息todo
router.get("/api/miniapps/getWXGoodsInfo", async (ctx, next) => {
  let params = ctx.request.query;
  await getWXGoodsInfoService(ctx, params);
})



//////////////////////////最新版接口 供h5和小程序调用////////////////

//获取商品列表
router.get("/api/getGoodsList", async (ctx, next) => {
  let params = ctx.request.query;
  Console.log(ctx.request.query)
  await getGoodsListService(ctx, params);
})

//获取商品详情
router.get("/api/getGoodsDetail", async (ctx, next) => {
  let params = ctx.request.query;
  await getGoodsDetailService(ctx, params);
})


module.exports = router;